class VocabularyOperations {
  /**
   * Update word's known status
   * @param {Object} model - The vocabulary model with database access
   * @param {string} word - Word text
   * @param {string} status - Status ('YES' or 'NO')
   * @returns {Promise} - Promise that resolves with the update result
   */
  static async updateKnownStatus(model, word, status) {
    // Validate inputs
    if (!word || typeof word !== 'string') {
      throw new Error('Invalid word parameter');
    }

    if (status !== 'YES' && status !== 'NO') {
      throw new Error('Invalid status parameter. Must be "YES" or "NO"');
    }

    try {
      return await model.updateKnownStatus(word, status);
    } catch (err) {
      throw new Error(`Failed to update known status: ${err.message}`);
    }
  }

  /**
   * Update word's IELTS tag
   * @param {Object} model - The vocabulary model with database access
   * @param {string} word - Word text
   * @param {string} tag - Tag ('YES' or 'NO')
   * @returns {Promise} - Promise that resolves with the update result
   */
  static async updateIeltsTag(model, word, tag) {
    // Validate inputs
    if (!word || typeof word !== 'string') {
      throw new Error('Invalid word parameter');
    }

    if (tag !== 'YES' && tag !== 'NO') {
      throw new Error('Invalid tag parameter. Must be "YES" or "NO"');
    }

    try {
      return await model.updateIeltsTag(word, tag);
    } catch (err) {
      throw new Error(`Failed to update IELTS tag: ${err.message}`);
    }
  }
}

module.exports = VocabularyOperations;